import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};

export default new Router({
  linkActiveClass: "active",
  routes: [
    {
      path: "/demo",
      name: "demo",
      component: () => import("../pages/meng/demo.vue")
    },
    {
      path: "/egImg/:id",
      name: "egImg",
      component: () => import("../pages/egImg.vue")
    },
    {
      path: "/",
      name: "index",
      component: () => import("../pages/index")
    },
    {
      path: "/live/:id",
      name: "live",
      component: () => import("@/pages/meng/live/live1.vue")
    },
    {
      path: "/talent_main/:model",
      name: "talent_main",
      component: () => import("@/pages/meng/talent/talent_main.vue"),
      children: [
        {
          path: ":id",
          name: "hot_analyse",
          component: () => import("../pages/meng/shop/hot_analyse")
        },
        {
          path: ":id/:index",
          name: "left",
          component: () => import("../pages/meng/shop/left")
        },
        {
          path: ":id/:index/:p3/:p4",
          name: "hot_video",
          component: () => import("../pages/meng/video/hot_video")
        },
        {
          path: ":id/:index/:p3/:p4/:p5",
          name: "sale",
          component: () => import("../pages/meng/shop/sale")
        }
      ]
    },
    // 智能分析
    {
      path: "/inAnalysis/:model",
      name: "inAnalysis",
      component: () => import("../pages/wang/inAnalysis/inAnalysisRoot")
    },

    {
      path: "/AccountDiagnosis",
      name: "AccountDiagnosis",
      component: () => import("../pages/wang/inAnalysis/AccountDiagnosis")
    },
    {
      path: "/testNum",
      name: "testNum",
      component: () => import("../pages/wang/testNum.vue")
    },
    {
      path: "/corporate",
      name: "corporate",
      component: () => import("../pages/corporate/index.vue")
    },
    {
      path: "/test",
      name: "test",
      component: () => import("../pages/test/test.vue")
    },
   
  ],

  scrollBehavior(to, from, saveTop) {
    if (saveTop) {
      return saveTop;
    } else {
      return {
        x: 0,
        y: 0
      };
    }
  },
  mode: "history"
});
